package com.example.demo.controller;

import com.example.demo.authorization.annotation.Authorization;
import com.example.demo.dao.UserMapper;
import com.example.demo.model.UserDto;
import com.wordnik.swagger.annotations.ApiImplicitParam;
import com.wordnik.swagger.annotations.ApiImplicitParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserInfoController {

    private final Logger logger = LoggerFactory.getLogger(UserInfoController.class);
    @Autowired
    private UserMapper userMapper;

    @Resource
    private RedisTemplate<String,Object> redisTemplate;

    @RequestMapping(value = "/user/info",method = RequestMethod.GET)
    @Authorization
    public UserDto getUserInfo(){
        UserDto userDto = userMapper.selectUserInfo();
//        redisTemplate.opsForValue().set(userDto.getName(),userDto);
//        Object o = redisTemplate.opsForValue().get(userDto.getName());
//        logger.info("11111111111111:"+o);
        return userDto;
    }
}
